<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="vue.js"></script>

</head>

<body>
  <div id="app">
    <button @click="arr.push(6)">增加</button>
    <ul ref="oul">
      <li v-for="(item,index) in arr" :key="index">
        {{item}}
      </li>
    </ul>
  </div>
  <script>
    new Vue({
      el: "#app",
      data:{
        arr:[1,2,3,4]
      },
      beforeCreate () {
        console.log("实例初始化完成之前");
        // this.arr.push(5);
        console.log(this.arr);
      },
      created(){
        console.log("实例初始化完成");
        //this.arr.push(5);
        console.log(this.arr);
        // created 做一些 数据的初始化 如 调用ajax 数据赋值
        //console.log(this.$refs['oul']);
      },
      beforeMount () {
        console.log("vnode编译之前");
      },
      mounted () {
        console.log("dom编译完成了可以获取dom了");
        console.log(this.$refs['oul']);
        // 获取dom 
      },
      beforeUpdate () {
        console.log("数据更新，dom更新前");
        console.log(this.$refs['oul'].children)
      },
      updated () {
        console.log("数据更新，dom更新完成了");
        console.log(this.$refs['oul'].children)
      },
      beforeDestroy () {
        console.log("实例销毁之前")
      },
      destroyed () {
        console.log("实例已经销毁")
      }
    })
  </script>
</body>

</html>